<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <!-- module属于严格模式 -->
  <script type="module">
    import obj from './module1.js'
    import { a, b } from './module2.js'
    import fn from './module3.js'
    console.log(obj);
    console.log(a, b);
    fn();

    // 模块化里没有this
    // console.log(this);

    // 按需导入
    let i = import('./module1.js'); // 返回一个promise对象
    
    i.then((res) => {
      console.log(res.default);
    })
</script>
</body>
</html>